package cn.itcast.web;

import cn.itcast.config.ConfigA;
import cn.itcast.domain.Category;
import cn.itcast.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

public class UserController {
    public static void main(String[] args) {

        AnnotationConfigApplicationContext ca=new AnnotationConfigApplicationContext(ConfigA.class);
        //ClassPathXmlApplicationContext ca=new ClassPathXmlApplicationContext("applicationContext.xml");

        UserService service = ca.getBean("userServiceImpl", UserService.class);

        List<Category> list = service.findAll();
        for (Category category : list) {
            System.out.println(category);
        }
    }
}
